{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-09-15T08:16:42.050640Z",
     "start_time": "2025-09-15T08:16:42.048076Z"
    }
   },
   "source": [
    "def is_iterable(param):\n",
    "    try:\n",
    "        iter(param)\n",
    "        return True\n",
    "    except TypeError:\n",
    "        return False\n",
    "\n",
    "params = [\n",
    "    1234,\n",
    "    '1234',\n",
    "    [1, 2, 3, 4],\n",
    "    set([1, 2, 3, 4]),\n",
    "    {1:1, 2:2, 3:3, 4:4},\n",
    "    (1, 2, 3, 4)\n",
    "]\n",
    "\n",
    "for param in params:\n",
    "    print('{} is iterable? {}'.format(param, is_iterable(param)))"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1234 is iterable? False\n",
      "1234 is iterable? True\n",
      "[1, 2, 3, 4] is iterable? True\n",
      "{1, 2, 3, 4} is iterable? True\n",
      "{1: 1, 2: 2, 3: 3, 4: 4} is iterable? True\n",
      "(1, 2, 3, 4) is iterable? True\n"
     ]
    }
   ],
   "execution_count": 4
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
